package me.tuyou.activiti.xmlParse;

import org.activiti.bpmn.converter.BpmnXMLConverter;
import org.activiti.bpmn.model.BpmnModel;
import org.activiti.bpmn.model.Process;
import org.activiti.engine.impl.util.io.InputStreamSource;
import org.activiti.engine.impl.util.io.StreamSource;
import org.springframework.core.io.ClassPathResource;

import java.io.IOException;

public class XmlParseTest {

    public static void main(String[] args) throws IOException {
        ClassPathResource resource = new ClassPathResource("HelloWorld.bpmn");
        StreamSource source = new InputStreamSource(resource.getInputStream());
        BpmnXMLConverter converter = new BpmnXMLConverter();
        BpmnModel bpmnModel = converter.convertToBpmnModel(source, false, false, "utf-8");
        Process leave = bpmnModel.getProcess("leave");
        System.out.println(bpmnModel);
    }
}
